/**
 * 
 */

$(function(){
	/*初始化表格*/
	$('#taskTemplate').datagrid({
		title:"计划模版管理",
		iconCls:'icon-edit',
		striped:true,
		border: true,
		collapsible:false,//是否可折叠的  
		fitColumns: true,
		loadMsg:"数据正在加载,请稍候...",
		rownumbers:true,
		singleSelect:false,
		selectOnCheck: true,
		checkOnSelect: true,
        url:'data/taskTemplate.json', 
        pagination:true,
        columns:[[   
                  {field:'ck',checkbox:true},
                  {field:'title',title:'计划标题',width:$(this).width() * 0.2}, 
                  {field:'creater',title:'创建人',width:$(this).width() * 0.1},
                  {field:'copycycle',title:'模版复制周期',width:$(this).width() * 0.2},
                  {field:'source',title:'计划来源',width:$(this).width() * 0.2}, 
                  {field:'type',title:'计划分类',width:$(this).width() * 0.2}, 
                  {field:'unable',title:'是否失效',width:$(this).width() * 0.1}   
              ]],
       
       /* frozenColumns:[[  
                        {field:'ck',checkbox:true}  
        ]],  */
        toolbar: [{  
            text: '添加',  
            iconCls: 'icon-add',  
            handler: function() {  
            	showAdd("#dlg","新增计划模板","#taskTemplateForm","index.json");
            }  
        }, '-', {  
            text: '修改',  
            iconCls: 'icon-edit',  
            handler: function() {  
            	showEdit('#taskTemplate','#dlg','修改计划','#taskTemplateForm','data/index.json');
            }  
        }, '-',{  
            text: '删除',  
            iconCls: 'icon-remove',  
            handler: function(){  
                del('#taskTemplate','data/index.json');  
            }  
        }/*, '-',{  
            text: '查看',  
            iconCls: 'icon-nav-punishment',  
            handler: function(){  
                view('#home','#viewplan','查看计划');  
            }  
        }*/]
    });  
	
});